package filter

import (
	"fmt"
	"net/http"
	"reflect"
	"runtime"
)

func Log(h func(writer http.ResponseWriter, request *http.Request)) func(writer http.ResponseWriter, request *http.Request) {
	return func(writer http.ResponseWriter, request *http.Request) {
		name := runtime.FuncForPC(reflect.ValueOf(h).Pointer()).Name()
		fmt.Println("Handler function callled -" + name)
		h(writer, request)
	}
}
